<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="Model.*"%>
<%@page import="Controller.*"%>
<%@page import="java.sql.*" %> 
<%@page import="java.io.*" %>
<%@include file="includes/header.jsp" %>
<%
    String id = session.getAttribute("id").toString();
    Query q = new Query();
    ResultSet rs = q.getTurmas(id);

%>
<div class="row-fluid">
    <div class="span12">
        <h1>Minhas turmas</h1>
        <hr/>
    </div>
</div>
<% while (rs.next()) {%>
<%
    String dia1 = "";
    String dia2 = "";
    String dia3 = "";
    switch (rs.getInt("dia1")) {
        case 1:
            dia1 = "Segunda-feira";
            break;
        case 2:
            dia1 = "Terca-feira";
            break;
        case 3:
            dia1 = "Quarta-feira";
            break;
        case 4:
            dia1 = "Quinta-feira";
            break;
        case 5:
            dia1 = "Sexta-feira";
            break;
        default:
            dia1 = "-";
            break;
    }
    switch (rs.getInt("dia2")) {
        case 1:
            dia2 = "Segunda-feira";
            break;
        case 2:
            dia2 = "Terca-feira";
            break;
        case 3:
            dia2 = "Quarta-feira";
            break;
        case 4:
            dia2 = "Quinta-feira";
            break;
        case 5:
            dia2 = "Sexta-feira";
            break;
        default:
            dia2 = "-";
            break;
    }

    switch (rs.getInt("dia3")) {
        case 1:
            dia3 = "Segunda-feira";
            break;
        case 2:
            dia3 = "Terca-feira";
            break;
        case 3:
            dia3 = "Quarta-feira";
            break;
        case 4:
            dia3 = "Quinta-feira";
            break;
        case 5:
            dia3 = "Sexta-feira";
            break;
        default:
            dia3 = "-";
            break;

    }

%>
<div class="row-fluid">
    <div class="span12 well">
        <h3><%=rs.getString("disciplina")%></h3>
        <h5><b>Sala:</b> <%=rs.getString("sala")%></h5>
        <h5><b>Dias/horarios:</b> <%
            out.print("<span class='label label-info'>");
            out.print(dia1);
            out.print(" / ");
            out.print(rs.getString("hora1"));            
            out.print(" </span> ");
            
            
            if (!dia2.equals("-")) {
                out.print("<span class='label label-warning'>");
                out.print(dia2);
                out.print(" / ");
                out.print(rs.getString("hora2"));
                out.print(" </span> ");
            }
            if (!dia3.equals("-")) {
                out.print("<span class='label label-success'>");
                out.print(dia3);
                out.print(" / ");
                out.print(rs.getString("hora3"));
                out.print(" </span> ");
            }
            %></h5>            
    </div>
</div>
<% }%>
<%@include file="includes/footer.jsp" %>